package me.gacl.websocket;

import java.io.Serializable;

/**
 * WebSocketClient信息封装
 * Created by 孤傲苍狼 on 2016/2/19.
 */
public class WebSocketClientInfo implements Serializable {

    //客户端Id,由clientName+sessionId组成
    private String clientId;
    //客户端名称
    private String clientName;
    //客户端连接成功后服务器分配的sessionId
    private String sessionId;
    //客户端连接时间
    private String connTime;
    //客户端连接IP地址
    private String ip;

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getClientName() {
        return clientName;
    }

    public void setClientName(String clientName) {
        this.clientName = clientName;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    public String getConnTime() {
        return connTime;
    }

    public void setConnTime(String connTime) {
        this.connTime = connTime;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }


    /**
     * 重写equals方法,用于比较两个对象是否相等
     * @param obj
     * @return
     */
    public boolean equals(Object obj) {
        if (obj instanceof WebSocketClientInfo) {
            WebSocketClientInfo webSocketClientInfo = (WebSocketClientInfo) obj;
            return this.clientId.equals(webSocketClientInfo.clientId);
        }
        return super.equals(obj);
    }
}
